package com.trkj.pojo;

import java.io.Serializable;
import javax.persistence.*;

import com.alibaba.fastjson.annotation.JSONField;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;


/**
 * The persistent class for the PROJECT_TEMPLATE database table.
 * 
 */
@Entity
@Table(name="PROJECT_TEMPLATE")
@NamedQuery(name="ProjectTemplate.findAll", query="SELECT p FROM ProjectTemplate p")
public class ProjectTemplate implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="PROJECT_TEMPLATE_TEMPLATEID_GENERATOR", sequenceName="HR")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="PROJECT_TEMPLATE_TEMPLATEID_GENERATOR")
	@Column(name="TEMPLATE_ID")
	private long templateId;
	@JSONField(format="yyyy-MM-dd HH:mm:ss")
	@Column(name="TEMPLATE_CREATORDATE")
	private Timestamp templateCreatordate;

	@Column(name="TEMPLATE_NAME")
	private String templateName;

	@Column(name="TEMPLATE_PERSON")
	private String templatePerson;

	@Column(name="TEMPLATE_REMARKS")
	private String templateRemarks;

	@Column(name="VARSION_NUMBER")
	private BigDecimal varsionNumber;
	@JSONField(serialize=false)
	//bi-directional many-to-one association to SalaryAccount
	@OneToMany(mappedBy="projectTemplate")

	private List<SalaryAccount> salaryAccounts;

	//bi-directional many-to-many association to SalaryProject
	@ManyToMany(mappedBy="projectTemplates")
	@JSONField(serialize=false)
	private List<SalaryProject> salaryProjects;

	public ProjectTemplate() {
	}

	public long getTemplateId() {
		return this.templateId;
	}

	public void setTemplateId(long templateId) {
		this.templateId = templateId;
	}

	public Timestamp getTemplateCreatordate() {
		return this.templateCreatordate;
	}

	public void setTemplateCreatordate(Timestamp templateCreatordate) {
		this.templateCreatordate = templateCreatordate;
	}

	public String getTemplateName() {
		return this.templateName;
	}

	public void setTemplateName(String templateName) {
		this.templateName = templateName;
	}

	public String getTemplatePerson() {
		return this.templatePerson;
	}

	public void setTemplatePerson(String templatePerson) {
		this.templatePerson = templatePerson;
	}

	public String getTemplateRemarks() {
		return this.templateRemarks;
	}

	public void setTemplateRemarks(String templateRemarks) {
		this.templateRemarks = templateRemarks;
	}

	public BigDecimal getVarsionNumber() {
		return this.varsionNumber;
	}

	public void setVarsionNumber(BigDecimal varsionNumber) {
		this.varsionNumber = varsionNumber;
	}

	public List<SalaryAccount> getSalaryAccounts() {
		return this.salaryAccounts;
	}

	public void setSalaryAccounts(List<SalaryAccount> salaryAccounts) {
		this.salaryAccounts = salaryAccounts;
	}

	public SalaryAccount addSalaryAccount(SalaryAccount salaryAccount) {
		getSalaryAccounts().add(salaryAccount);
		salaryAccount.setProjectTemplate(this);

		return salaryAccount;
	}

	public SalaryAccount removeSalaryAccount(SalaryAccount salaryAccount) {
		getSalaryAccounts().remove(salaryAccount);
		salaryAccount.setProjectTemplate(null);

		return salaryAccount;
	}

	public List<SalaryProject> getSalaryProjects() {
		return this.salaryProjects;
	}

	public void setSalaryProjects(List<SalaryProject> salaryProjects) {
		this.salaryProjects = salaryProjects;
	}

}